package cn.wizzer.app.user.modules.models;


import cn.wizzer.framework.base.model.BaseModel;
import lombok.Data;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;
import org.nutz.integration.json4excel.annotation.J4EIgnore;

import java.io.Serializable;
import java.math.BigDecimal;

@Data
@Table("user_cash")
@TableIndexes({@Index(name = "INDEX_CT_AT", fields = {"ctAt"}, unique = false),
        @Index(name = "unique_no", fields = {"no"}, unique = true)})
public class UserCash extends BaseModel implements Serializable {

    @Column
    @Name
    @Comment("ID")
    @J4EIgnore
    @ColDefine(type = ColType.VARCHAR, width = 32)
    @PrevInsert(uu32 = true)
    private String id;

    @Column("user_id")
    @Comment("用户ID")
    @ColDefine(type = ColType.VARCHAR, width = 32)
    private String userId;

    @Column("no")
    @Comment("单号")
    @ColDefine(type = ColType.VARCHAR, width = 32)
    private String no;

    @Column
    @Comment("金额")
    @ColDefine(type=ColType.FLOAT, width=16, precision=6)
    private BigDecimal amount;

    @Column
    @Comment("状态->0:待确认1:待到账2:成功3:失败")
    @ColDefine(type=ColType.INT, width=1)
    private Integer status;

    @Column
    @Comment("创建时间")
    @PrevInsert(els = @EL("$me.now()"))
    private Long ctAt;

    @Column("remark")
    @Comment("备注")
    @ColDefine(type = ColType.VARCHAR, width = 64)
    private String remark;

}
